/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#include "CheckBox.h"
#include "../CheckBox.h"

namespace liba
{
namespace lib2d
{
namespace gui
{
namespace view
{

CheckBox::CheckBox( gui::CheckBox * obj )
:	Button( obj ),
	obj( obj ),
	checker_rect( 0, 0, 0, 0 )
{}

void CheckBox::render( hard::Renderer * rend )
{
	Button::render( rend );
	if( obj->is_checked() )
		image->blit( rend, Vector2( 0, 0 ), checker_rect );
}

bool CheckBox::on_attribute( xml::Provider * prov, const std::string & name, const std::string & value )
{
	if( name == "Checker" )
		return converter::convert( value, &checker_rect );

	return Button::on_attribute( prov, name, value );
}

} //namespace view
} //namespace gui
} //namespace lib2d
} //namespace liba

